package cn.test.learnkotlin.v1

private class IDataAndSealed {
    data class User(val name: String, val age: Int) {

    }

    fun fooData() {
        val user = User("KK", 18)
        user.component1()
        user.component2()
        val userUp = user.copy(name = "KKUp", age = 24)
        println("name:${userUp.name}")
        println("age:${userUp.age}")
        val (name, age) = user
        println("name:$name ,age:$age")
    }

    sealed interface ExprI {}
    sealed class Expr {}

    data class Const(val number: Double) : Expr()
    data class Sum(val e1: Expr, val e2: Expr) : Expr()
    object NotANumber : Expr()

    fun main() {
        fooData()
    }
}

fun main() {
    IDataAndSealed().main()
}